var mongoose = require('../mongoose.js').mongoose;
var SchemaHero = require('./schemaHero.js').SchemaHero;
var Hero = require('./schemaHero.js').Hero;


var SchemaUser = mongoose.Schema({
    username    :   { type : String, required : true, unique : true, trim : true },
    password    :   { type : String, required : true },
    heros       :   [SchemaHero]
});

SchemaUser.methods.setHero = function(hero){
    this.heros.push(hero);
}

var User = mongoose.model('User', SchemaUser);


exports.User = User;